﻿
function changeImage(sPath,sImage)
{
  var  Iimage= document.all["Picture"];
  Iimage.src=sPath +sImage;
  var  intHeight,intWidth,intScale;
  intWidth=Iimage.width;
  intHeight=Iimage.height;
  intScale=intWidth/intHeight;
  if(intWidth>300)
  {
     Iimage.width=300;
     Iimage.height=300* intScale;
  }  
}
function Filechange(obj)
{
   Iimage= document.all["Picture"];
   Iimage.src=obj.value;
   
}
function Height_Width(obj)
{

  if(obj.value!="")
  {
	Iimage=document.all["Picture"];
	var img= new Image();
	img.src=obj.value;
	document.all["Height"].value=img.height;
	document.all["Width"].value=img.width;
	
	Iimage.src=obj.value;
  }
   
}
 function ShowWindow(sUrl,w,h)
  {
    var winX = 0;
 	var winY = 0;
  	if (parseInt(navigator.appVersion) >= 4)
  	{
    	winX = (screen.availWidth - w)*.5;
		winY = (screen.availHeight - h)*.5;
  	}
	popupLoadnWin=window.open(sUrl,'popupLoadnWin','scrollbars,resizable=no,status=yes, width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
	         
  }

function SelectImage()
{
    var objSelect =document.getElementsByTagName("select");
    var sValue="";
    
    if(objSelect!=null)
         sValue= objSelect[0].options[objSelect[0].selectedIndex].value;
    window.opener.document.getElementById("hddPicture").value= "Images/Share/" +sValue;
    window.opener.document.getElementById("Picture").src="Images/Share/" +sValue;
    window.opener.document.getElementById("PictureName").innerText=sValue;
    window.close();
}
function getFileOnly(sValue)
{
   var sResult="";
   var i=sValue.lastIndexOf('/') +1;
   if(sValue!='')
      sResult=sValue.substring(i);
   document.all["PictureName"].innerText=sResult;
   return sResult
}
function setHiddenField(sValue)
{
     document.all["PictureName"].innerText=getFileOnly(sValue);
     document.all["hddPicture"].value=sValue;
}
//<--------Hàm lấy dữ liệu từ thẻ div vào span-------->
function setDesOfPhotoReport(objSrc,objDes,sFileName)
{
   document.all[objDes].innerText=document.all[objSrc].innerText;
   document.all['PhotoReportPicture'].src="" + sFileName;
}



// Hàm hiển thị ảnh mờ
nereidFadeObjects = new Object(); 
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){ 	if (!document.all) 
		return 
	if (object != "[object]"){ 
		setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
		return; 
	} 
	
	clearTimeout(nereidFadeTimers[object.sourceIndex]); 
		
		diff = destOp-object.filters.alpha.opacity; 
		direction = 1; 
		
		if (object.filters.alpha.opacity > destOp){ 			direction = -1; 
		} 
		delta=Math.min(direction*diff,delta); 
		object.filters.alpha.opacity+=direction*delta; 
		if (object.filters.alpha.opacity != destOp){ 

			nereidFadeObjects[object.sourceIndex]=object; 
nereidFadeTimers[object.sourceIndex]=
	setTimeout ("nereidFade(nereidFadeObjects["+object.sourceIndex+"], "+destOp+", "+rate+", "+delta+")", rate); 
		}
} 
